<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
	<head>
		<jsp:include page="../inc.jsp"></jsp:include>
		<jsp:include page="../head.jsp"/>
		<meta http-equiv="X-UA-Compatible" content="edge" />
		<title>提现订单查询</title>
		<style>
		.mynewBtn{
		display: block;
		width:64px;
		height:20px;
		background: #3989c8;
		margin-left:10px;
		float: left;
		color: #FFFFFF;
		border:1px solid #3989c8;
		-moz-border-radius: 3px;      /* Gecko browsers */
	    -webkit-border-radius: 3px;   /* Webkit browsers */
	    border-radius:3px;
	    text-decoration:none;
	    text-align:center;
	}
		 .blue_btn{
            border: none;
            border-radius: 5px;
            background-color: #3989c8;
            padding: 5px 20px;
            color:#fff;
        }
        #toolbar{
            height: 60px;
            margin-top: 5px;
            overflow:hidden;
        }
        .list{
            clear: both;
            width: 100%;
            list-style: none;
            padding-left:0px;
        }
        .list li{
            float: left;
            margin-right: 15px;
        }
        .textbox{
            height: 20px;
            margin: 0;
            padding: 0 2px;
            box-sizing: content-box;
            border: 1px solid #95B8E7;
            vertical-align: middle;
			border-radius:3px;
        }
        .combo{
   		border-radius:3px;
   		}
      
   		
		</style>
		<script type="text/javascript">
		//查看电子对账单
		function elecAccount(cashNo){
			//alert(cashNo);
			layer.open({
				type: 2,
				title: ['对账查看','background-color:#00B2EE; color:#fff;'],
				shadeClose: true,
				shade: 0.3,
				area: ['658px', '400px'],  
				content: ['${ctx}/statement/toStatementDetail?cashNo='+cashNo]  // iframe的url，no代表不显示滚动条
				
			});
		}
		//查看详情
		function viewDetail(cashNo){
		
			layer.open({
				type: 2,
				title: ['提现单详情','background-color:#00B2EE; color:#fff;'],
				shadeClose: true,
				shade: 0.3,
				yes: function(index, layero) {
					layer.close(index);
				},
				btn2: function(index, layero) {
					//取消的回调
				},
				area: ['1200px', '1200px'],  
				content: ['${ctx}/statement/settlementOrderPage/'+cashNo], //iframe的url，no代表不显示滚动条
				success: function(layero, index){
					  layer.full(index);
				},
				end:function(){
					//localtion.reload();
				}
			});
		}
		
		
		$(function(){			
			 $("#query").click(function (){
			        var cashNo="";//提现单号
			        var orgName="";//供应商			       
			        var startDate="";//申请日期
			        var endDate="";//结束日期
			        var status=""; //财务状态
			        cashNo=$("#cashNo").val();  			        
			        orgName=$("#orgName").val();
			        startDate=$("#startDate").val();
			        endDate=$("#endDate").val();
			        status=$("#status").combobox("getValue");
			        //console.log(cashNo);
			        $("#dataGrid").datagrid('load',{
			            "cashNo":cashNo,
			            //"cashTime":orgName,
			            "startTime":startDate,
			            "endTime":endDate,
			            "status":status
			        });
			    });
				 
			    dataGrid = $('#dataGrid').datagrid({
			        url: '${ctx}/withdrawal/find?temp='+Math.random(),			       
			        striped : true,
			        fitColumns:false,
			        singleSelect : false,
			        pagination : true,
			        pageSize : 20,
			        pageList : [ 20, 30, 40, 50, 100, 200, 300, 400, 500 ],
			        idField : ' id',
			        method : 'get',
			      columns:[ [ {
			            width : '100',
			            title : 'id',
			            align : 'center',
			            field : 'id',
			            hidden:true
			        },{
			            width : '180',
			            title : '提现单号',
			            align : 'center',
			            field : 'cashNo',
			           
			        },{
			            width : '150',
			            title : '申请提现金额',
			            align : 'center',
			            field : 'cashMoney'
			        },{
			            width : '150',
			            title : '提现提现时间',
			            align : 'center',
			            field : 'cashTime',
			           
			        },{
			        	 width : '120',
				         title : '财务状态',
				         align : 'center',
				         field : 'status',
				         formatter:function(value,row,index){
				        	 	var str=CommonConverter.toOrderPayStatusStr(row.status);
				            	return str;
				            }
			        },{
			        	 width : '200',
				         title : '操作',
				         align : 'center',
				         field : 'action',
				         formatter:function(value,row,index){
					            	var str='';					            	
									str += '<a href="javascript:void(0)" class="mynewBtn"   onclick=viewDetail("'+row.cashNo+'"); >查看详情</a>';	
									if(row.status==6){
										str+='<a href="javascript:void(0)" class="mynewBtn"  onclick=elecAccount("'+row.cashNo+'"); >查看对账单</a>';
									}
					            	return str;
					            }
			        }
			        ] ]
			    });		
		}); 
	
		</script>
	</head>
	<body style="padding-left:10px;">
    <div data-options="region:'north',border:false">
        <div id="toolbar">
        <ul class="list">
            <li>提现单号：<input type="text" class="textbox" id="cashNo"/></li>           
            <li>
                申请日期：
                <input type="text" id="startDate" class="textbox" onclick="new WdatePicker({dateFmt:'yyyy-MM-dd'})"/> -
                <input type="text" id="endDate" class="textbox" onclick="new WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
            </li>
            <li>
                财务状态：
                <select class="easyui-combobox" data-options="panelHeight:'auto'" id="status">
                    <option value="">全部</option>
                    <option value="4">提现待审核</option>
                    <option value="5">提现待支付</option>
                    <option value="6">已付款</option>
                </select>
            </li>
            <li><input type="button" value="查询" class="blue_btn" id="query"/></li>
        </ul>
        </div>
    </div>

    <div>
    	<table id="dataGrid" clas="easyui-datagrid"></table>
    </div>

    <jsp:include page="../footer.jsp"/>
	</body>
</html>